package co.sanduche.behave.views;

import java.util.List;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import co.sanduche.behave.BehaveApp;
import co.sanduche.behave.R;
import co.sanduche.behave.presenters.MateriasPresenter;
import co.sanduche.behave.views.MainActivity.NavigationFragment;
import co.sanduche.models.Models.Materia;

public class MateriasFragment extends NavigationFragment implements
		OnItemClickListener, MateriasView {

	private ListView materias;
	private MateriasPresenter presenter;
	private long idEstudiante;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.main_seguimiento_fragment,
				container, false);

		materias = (ListView) rootView
				.findViewById(R.id.seguimientoListMaterias);
		materias.setOnItemClickListener(this);
		idEstudiante = getActivity().getIntent().getLongExtra(
				BehaveApp.ID_ESTUDIANTE_EXTRA, 0);
		presenter = new MateriasPresenter(this, idEstudiante);

		return rootView;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		idEstudiante = getActivity().getIntent().getLongExtra(
				BehaveApp.ID_ESTUDIANTE_EXTRA, 0);
	}

	@Override
	public void onResume() {
		super.onResume();
		presenter.onResume();
	}

	@Override
	public String getPageTitle() {
		return "Seguimiento";
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub

	}

	@Override
	public void showMaterias(List<Materia> val) {
		for (Materia m : val) {
			System.out.println(m);

		}
	}

}
